<template>
	<view class=" container">
		<navbar title="账户注销" />
		<view class="title">
			妙有芯世界
		</view>
		<view class="title">
			<image class="avatarImg" :src="info.avatarUrl" mode="aspectFill"></image>
			<view class="name">{{info.nickname}}</view>
		</view>
		<view class="btn" @click="logOut">
			确认注销
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info: {}
			}
		},
		onLoad() {
			this.getInfo()
		},
		methods: {
			getInfo() {
				this.$post("/user/info").then(res => {
					this.info = res.data.userInfo
				})
			},
			logOut() {
				this.$model("确定要注销吗？").then(res => {
					this.$post("/user/accountDel").then(res => {
						uni.reLaunch({
							url: "/pages/login/login"
						})
					})
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #35CBAD;
	}

	.title {
		text-align: center;
		font-weight: bold;
		color: #fff;
		font-size: 40rpx;
		margin: 90rpx 0;
		.name{
			height: 100rpx;
		}
		.avatarImg{
			width: 100rpx;
			height: 100rpx;
			border-radius: 100rpx;
		}
	}
	

	.btn {
		text-align: center;
		color: #fff;
		background-color: $assist-color2;
		border-radius: 100px;
		line-height: 80rpx;
		font-weight: bold;
		margin-top: 150rpx;
	}
</style>